'''
输入两个正整数m、n，编写4个函数完成如下功能：(文件名：py0227.py)
（1）求出m和n两个数之间所有“明7暗7”数，即数字中有7或能整除7，如37，63.
（2）分别求出m! 和 n!
（3）求m和n的最大公约数和最小公倍数。
（4）求出m和n两个数之间的所有回文数。
'''

import re


def ming7an7(a, b):
    list_ans = []
    for i in range(a, b + 1):
        if i % 7 == 0:
            list_ans.append(i)
        else:
            temp = i
            while temp > 0:
                digit = temp % 10
                if digit == 7:
                    list_ans.append(i)
                    break
                temp /= 10
    return list_ans


def factorial(a, b):
    a_, b_ = 1, 1
    for i in range(1, a + 1):
        a_ *= i
    for i in range(1, b + 1):
        b_ *= i
    return a_, b_


def gcd_(a, b):  # 欧几里得算法求公倍数
    max_num = max(a, b)
    min_num = min(a, b)
    while min_num != 0:
        remainder = max_num % min_num
        max_num = min_num
        min_num = remainder
    min_common = int(a * b / max_num)  # max_num 就是最后所求的最大公倍数
    return max_num, min_common


def huiwenshu(a, b):
    ans = []
    for i in range(a, b + 1):
        if i == int(str(i)[::-1]):
            ans.append(i)
    return ans


m = int(input("请输入一个整数m:"))
n = int(input("请输入一个整数n:"))
max_num = max(m, n)
min_num = min(m, n)
print("{}到{}之间所有的明7暗7数有：".format(min_num, max_num))
print(ming7an7(min_num, max_num))

print("{}!和{}!的阶乘分别为：".format(min_num, max_num))
print(factorial(min_num, max_num))
print("{}和{}的最大公约数和最小公倍数分别为：".format(min_num, max_num))
print(gcd_(min_num, max_num))
print("{}到{}之间所有的回文数有：".format(min_num, max_num))
print(huiwenshu(min_num, max_num))
